package ar.edu.unq.wannaplay.pages;

import org.apache.wicket.markup.html.CSSPackageResource;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;

import ar.edu.unq.wannaplay.panels.ChooseLanguagePanel;
import ar.edu.unq.wannaplay.panels.FeedBackPanel;
import ar.edu.unq.wannaplay.panels.SideBarPanel;

public abstract class WPPage extends WebPage {

    private FeedBackPanel feedBackPanel;

    private final String sectionTitle;

    protected WPPage(final String sectionTitle) {
        super();
        this.sectionTitle = sectionTitle;
        this.add(CSSPackageResource.getHeaderContribution(WPPage.class, "styles.css"));
    }

    protected void initialize() {
        this.addSidebar();
        this.addFeedBackPanel();
        this.addMainContent();
        this.addSectionTitle();
        // this.addLanguageSelect();
    }

    protected void addSectionTitle() {
        this.add(new Label("sectionTitle", this.getSectionTitle()));
    }

    protected void addFeedBackPanel() {
        this.setFeedBackPanel(new FeedBackPanel("feedbackPanel"));
        this.add(this.getFeedBackPanel());
    }

    protected void addLanguageSelect() {
        this.add(new ChooseLanguagePanel("languageChoice", this.getClass()));
    }

    // protected void addFooter() {
    // Footer footer = new Footer("Footer");
    // this.add(footer);
    // }

    protected void addSidebar() {

        SideBarPanel sideBarPanel = new SideBarPanel("sideBar");
        this.add(sideBarPanel);
    }

    protected abstract void addMainContent();

    public FeedBackPanel getFeedBackPanel() {
        return feedBackPanel;
    }

    public void setFeedBackPanel(final FeedBackPanel feedBackPanel) {
        this.feedBackPanel = feedBackPanel;
    }

    public String getSectionTitle() {
        return sectionTitle;
    }

}
